﻿using System;
using System.Collections.Generic;

namespace BSharp.Compiler.Emit
{
	public class ObjectCompilationUnit : CompilationUnit
	{
		private List<FunctionCompilationUnit> functions = new List<FunctionCompilationUnit> ();

		public override void CompileUnit (IntermediateCompiler compiler)
		{
			foreach (FunctionCompilationUnit unit in functions) {
				unit.CompileUnit (compiler);
			}
		}

		public void AddFunction (FunctionCompilationUnit unit)
		{
			functions.Add (unit);
		}

		public void DebugShowDisassembly ()
		{
			foreach (FunctionCompilationUnit unit in functions) {
				unit.DebugShowDisassembly ();
			}
		}
	}
}

